<template>
  <ElSelect v-model="model" v-bind="$attrs">
    <ElOption
      v-for="item of options"
      :key="item.value"
      :label="item.label"
      :value="item.value"
    ></ElOption>
    <component v-if="$slots" :is="h('template', $slots)"></component>
  </ElSelect>
</template>

<script lang="ts" setup>
import { ElSelect, ElOption } from 'element-plus'
import { h } from 'vue'

withDefaults(
  defineProps<{
    modelValue: string
    options: {
      label: string
      value: string
    }[]
  }>(),
  {},
)

const model = defineModel()
</script>
